package com.gzhryc.shared_device.oem.code.agent.dao.db;

import com.gzhryc.common.NumberTools;
import com.gzhryc.jdbc.annotaion.Column;
import com.gzhryc.jdbc.annotaion.JoinField;
import com.gzhryc.jdbc.annotaion.PrimaryKey;
import com.gzhryc.jdbc.annotaion.Table;
import com.gzhryc.shared_device.oem.code.agent.dao.enums.AgentRelationWalletEnum;

import java.io.Serializable;
import java.util.Date;

@Table(name = "agent_relation_wallet")
public class AgentRelationWallet implements Serializable {

    private static final long serialVersionUID = 1L;

	@PrimaryKey
    @Column(name = "user_id", note = "用户ID")
    protected Long userId;

    @PrimaryKey
    @Column(name = "relation_user_id", note = "关联用户ID")
    protected Long relationUserId;

    @PrimaryKey
    @Column(name = "account_group_id", notNull = true, note = "账号组ID")
    protected Long accountGroupId;

    @Column(name = "money", notNull = true, defVal = "0", note = "钱包余额，精确到厘")
    protected Long money;

    @Column(name = "withdrawn_money", notNull = true, defVal = "0", note = "已转出的金额，精确到厘")
    protected Long withdrawnMoney;

    @Column(notNull = true, defVal = "1",note = "钱包状态")
    protected Integer state;

    @Column(name = "last_update_date", note = "最后修改余额时间")
    protected Date lastUpdateDate;

    @Column(name = "update_date", autoUpdateTime = true)
    protected Date updateDate;

    @Column(name = "create_date")
    protected Date createDate;

    @JoinField(name = "name",fromField = "account_group_id",toTable = "payment_account_group")
    protected String accountGroupName;

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public Long getRelationUserId() {
        return relationUserId;
    }

    public void setRelationUserId(Long relationUserId) {
        this.relationUserId = relationUserId;
    }

    public Long getAccountGroupId() {
        return accountGroupId;
    }

    public void setAccountGroupId(Long accountGroupId) {
        this.accountGroupId = accountGroupId;
    }

    public Long getMoney() {
        return money;
    }

    public void setMoney(Long money) {
        this.money = money;
    }

    public Long getWithdrawnMoney() {
        return withdrawnMoney;
    }

    public void setWithdrawnMoney(Long withdrawnMoney) {
        this.withdrawnMoney = withdrawnMoney;
    }

    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    public Date getLastUpdateDate() {
        return lastUpdateDate;
    }

    public void setLastUpdateDate(Date lastUpdateDate) {
        this.lastUpdateDate = lastUpdateDate;
    }

    public Date getUpdateDate() {
        return updateDate;
    }

    public void setUpdateDate(Date updateDate) {
        this.updateDate = updateDate;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    public String getAccountGroupName() {
        return accountGroupName;
    }

    public void setAccountGroupName(String accountGroupName) {
        this.accountGroupName = accountGroupName;
    }
    
    public String getMoneyStr() {
    	return NumberTools.getMoneyLiStr(this.money);
    }
    
    public String getWithdrawnMoneyStr() {
    	return NumberTools.getMoneyLiStr(this.withdrawnMoney);
    }
    
    public String getStateName() {
    	return AgentRelationWalletEnum.State.note(this.state);
    }
}
